export function getMemberConfig(parameter) {
	return new Promise((resolve, reject) => {
		const params = {
			name: 'offiaccount',
			member_code: 'XkfifAgDb_bb_61boBxDw_cc__cc_',
			share_url: encodeURIComponent(window.location.href.split('#')[0]),
		};

		const xhr = new XMLHttpRequest();
		// const url = `https://gbh.zhongbenjiaoyu.com/api/v1/6702357908ca7`;
		const url = `https://yufabu.saizhuge.net/api/v1/6702357908ca7`;
		xhr.open('POST', url, true);
		xhr.setRequestHeader('Content-Type', 'application/json');

		xhr.onload = function() {
			if (xhr.status === 200) {
				console.log('Success:', JSON.parse(xhr.responseText));
				resolve(JSON.parse(xhr.responseText));
			} else {
				console.error('Error:', xhr.statusText);
				reject(xhr.statusText);
			}
		};

		xhr.onerror = function() {
			console.error('Request failed');
			reject('Request failed');
		};

		xhr.send(JSON.stringify(params));
	});

}
export function wexinUploadOss(parameter) {
	// return http.post(api.wexinUploadOss, parameter)
	console.log('parameter', parameter)

	return new Promise((resolve, reject) => {

		const xhr = new XMLHttpRequest();
		// const url = `https://gbh.zhongbenjiaoyu.com/api/v1/670c7bf1cc603`;
		const url = `https://yufabu.saizhuge.net/api/v1/6702357908ca7`;
		xhr.open('POST', url, true);
		xhr.setRequestHeader('Content-Type', 'application/json');

		xhr.onload = function() {
			if (xhr.status === 200) {
				console.log('Success:', JSON.parse(xhr.responseText));
				resolve(JSON.parse(xhr.responseText));
			} else {
				console.error('Error:', xhr.statusText);
				reject(xhr.statusText);
			}
		};

		xhr.onerror = function() {
			console.error('Request failed');
			reject('Request failed');
		};

		xhr.send(JSON.stringify(parameter));
	});
}